<!--  -->
<template>
  <div class="historyKeywordList">
    <header>
      <div>历史记录</div>
      <van-icon name="delete-o" @click="clear" />
    </header>
    <footer>
      <div
        class="goods"
        v-for="item in historyKeywordList"
        :key="item"
        @click="search(item)"
      >
        {{ item }}
      </div>
    </footer>
  </div>
</template>

<script>
// import {clearHistory} from '@/api/api.ts'
import { defineComponent } from "vue";
export default defineComponent({
  name: "HistoryKeywordList",
  props: {
    historyKeywordList: {
      type: Array,
      default() {
        return [];
      },
    },
  },
  setup(props, { emit }) {
    const search = (item) => {
      // console.log(emit());
      emit("getSearchReault", item);
    };
    const clear = () => {
      emit("clear");
    };
    return {
      search,
      clear,
    };
  },
});
</script>

<style lang="scss" scoped>
.historyKeywordList {
  width: 100%;
  /* height: 200px; */
  background-color: #fff;
  padding: 20px 20px;
  border-top: 1px solid #ccc;
}
header {
  width: 100%;
  height: 48px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 40px;
}
footer {
  display: flex;
  width: 100%;
  color: #969799;
  justify-content: flex-start;
  align-items: center;
  flex-flow: wrap;
  margin-top: 20px;
}
.goods {
  border: 1px solid #969799;
  padding: 0 4px;
  line-height: 24px;
  margin: 20px 20px 0 0;
}
</style>
